local t = Def.ActorFrame {};
local event = GAMESTATE:IsEventMode();
local stats = STATSMAN:GetCurStageStats();
local fail = stats:AllFailed();
local exg = GAMESTATE:HasEarnedExtraStage();
local ex = GAMESTATE:IsExtraStage();
local ex2 = GAMESTATE:IsExtraStage2();

if exg and ex2 then
	t[#t+1] = LoadActor("_omes")..{};
end

if fail then
	if event then
		t[#t+1] = Def.ActorFrame {
			LoadActor("_grid") .. {
				InitCommand=function(self) self:Center():diffusealpha(0.5):zoomx(1):zoomy(1):queuecommand("Scroll") end;
				ScrollCommand=function(self) self:y(20):linear(2):addy(50):queuecommand("Scroll") end;
			};
		};
	elseif not event then
		t[#t+1] = Def.ActorFrame {
			LoadActor(THEME:GetPathG("", "_static")) .. {
				InitCommand=function(self) self:FullScreen():diffusealpha(0) end;
				OnCommand=function(self) self:linear(0.3):diffusealpha(0.25) end;
			};
			LoadActor("_void")..{
				Condition=fail and ex2 and not exg;
				InitCommand=function(self) self:Center():diffusealpha(0.5) end;
			};
		};
	end
else
	t[#t+1] = Def.ActorFrame {
		LoadActor("_grid") .. {
			InitCommand=function(self) self:Center():diffusealpha(0.5):zoomx(1):zoomy(1) end;
			OnCommand=function(self)
				if exg then
					if ex2 then
						self:playcommand("Scroll2"):queuecommand("Vibe1")
					elseif ex then
						self:playcommand("Scroll"):y(20):linear(2):addy(50):diffuse(color("#770000")):queuecommand("Scroll")
					end
				else
					self:playcommand("Scroll")
				end
			end;
			ScrollCommand=function(self) self:y(20):linear(4):addy(100):queuecommand("Scroll") end;
			Scroll2Command=function(self) self:y(20):linear(3.3):addy(50) end;
			Vibe1Command=function(self) self:vibrate():effectmagnitude(3,3,3):sleep(0.2):queuecommand("Vibe2") end;
			Vibe2Command=function(self) self:vibrate():effectmagnitude(6,6,6):sleep(0.2):queuecommand("Vibe3") end;
			Vibe3Command=function(self) self:vibrate():effectmagnitude(9,9,9):sleep(0.2):queuecommand("Vibe4") end;
			Vibe4Command=function(self) self:vibrate():effectmagnitude(12,12,12):sleep(0.2):queuecommand("Vibe5") end;
			Vibe5Command=function(self) self:vibrate():effectmagnitude(15,15,15):sleep(0.2):queuecommand("Vibe6") end;
			Vibe6Command=function(self) self:vibrate():effectmagnitude(18,18,18):sleep(0.2):queuecommand("Vibe7") end;
			Vibe7Command=function(self) self:vibrate():effectmagnitude(21,21,21):sleep(0.1):queuecommand("Stop") end;
			StopCommand=function(self) self:diffusealpha(0):stopeffect() end;
		};
	};
end
return t
